/**
 * <copyright>
 * </copyright>
 *

 */
package org.eclipse.gittab.gitTabDsl.impl;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EDataType;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.impl.EFactoryImpl;
import org.eclipse.emf.ecore.plugin.EcorePlugin;
import org.eclipse.gittab.gitTabDsl.Beat;
import org.eclipse.gittab.gitTabDsl.Chord;
import org.eclipse.gittab.gitTabDsl.ChordDefinition;
import org.eclipse.gittab.gitTabDsl.ChordLibrary;
import org.eclipse.gittab.gitTabDsl.DownStroke;
import org.eclipse.gittab.gitTabDsl.Fret;
import org.eclipse.gittab.gitTabDsl.GitTabDslFactory;
import org.eclipse.gittab.gitTabDsl.GitTabDslPackage;
import org.eclipse.gittab.gitTabDsl.GuitarSound;
import org.eclipse.gittab.gitTabDsl.GuitarStr;
import org.eclipse.gittab.gitTabDsl.Hold;
import org.eclipse.gittab.gitTabDsl.Import;
import org.eclipse.gittab.gitTabDsl.Note;
import org.eclipse.gittab.gitTabDsl.NoteName;
import org.eclipse.gittab.gitTabDsl.NoteValues;
import org.eclipse.gittab.gitTabDsl.NoteWrapper;
import org.eclipse.gittab.gitTabDsl.Notes;
import org.eclipse.gittab.gitTabDsl.Pause;
import org.eclipse.gittab.gitTabDsl.Sound;
import org.eclipse.gittab.gitTabDsl.Stroke;
import org.eclipse.gittab.gitTabDsl.Tab;
import org.eclipse.gittab.gitTabDsl.TabModel;
import org.eclipse.gittab.gitTabDsl.Tone;
import org.eclipse.gittab.gitTabDsl.Tuning;
import org.eclipse.gittab.gitTabDsl.UpStroke;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model <b>Factory</b>.
 * <!-- end-user-doc -->
 * @generated
 */
public class GitTabDslFactoryImpl extends EFactoryImpl implements GitTabDslFactory
{
  /**
   * Creates the default factory implementation.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public static GitTabDslFactory init()
  {
    try
    {
      GitTabDslFactory theGitTabDslFactory = (GitTabDslFactory)EPackage.Registry.INSTANCE.getEFactory("http://www.eclipse.org/gittab/GitTabDsl"); 
      if (theGitTabDslFactory != null)
      {
        return theGitTabDslFactory;
      }
    }
    catch (Exception exception)
    {
      EcorePlugin.INSTANCE.log(exception);
    }
    return new GitTabDslFactoryImpl();
  }

  /**
   * Creates an instance of the factory.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public GitTabDslFactoryImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public EObject create(EClass eClass)
  {
    switch (eClass.getClassifierID())
    {
      case GitTabDslPackage.TAB_MODEL: return createTabModel();
      case GitTabDslPackage.IMPORT: return createImport();
      case GitTabDslPackage.TUNING: return createTuning();
      case GitTabDslPackage.GUITAR_STR: return createGuitarStr();
      case GitTabDslPackage.CHORD_LIBRARY: return createChordLibrary();
      case GitTabDslPackage.CHORD_DEFINITION: return createChordDefinition();
      case GitTabDslPackage.TAB: return createTab();
      case GitTabDslPackage.BEAT: return createBeat();
      case GitTabDslPackage.TONE: return createTone();
      case GitTabDslPackage.STROKE: return createStroke();
      case GitTabDslPackage.DOWN_STROKE: return createDownStroke();
      case GitTabDslPackage.UP_STROKE: return createUpStroke();
      case GitTabDslPackage.PAUSE: return createPause();
      case GitTabDslPackage.HOLD: return createHold();
      case GitTabDslPackage.SOUND: return createSound();
      case GitTabDslPackage.CHORD: return createChord();
      case GitTabDslPackage.NOTE: return createNote();
      case GitTabDslPackage.NOTE_WRAPPER: return createNoteWrapper();
      case GitTabDslPackage.FRET: return createFret();
      case GitTabDslPackage.NOTE_NAME: return createNoteName();
      default:
        throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier");
    }
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object createFromString(EDataType eDataType, String initialValue)
  {
    switch (eDataType.getClassifierID())
    {
      case GitTabDslPackage.GUITAR_SOUND:
        return createGuitarSoundFromString(eDataType, initialValue);
      case GitTabDslPackage.NOTES:
        return createNotesFromString(eDataType, initialValue);
      case GitTabDslPackage.NOTE_VALUES:
        return createNoteValuesFromString(eDataType, initialValue);
      default:
        throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
    }
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public String convertToString(EDataType eDataType, Object instanceValue)
  {
    switch (eDataType.getClassifierID())
    {
      case GitTabDslPackage.GUITAR_SOUND:
        return convertGuitarSoundToString(eDataType, instanceValue);
      case GitTabDslPackage.NOTES:
        return convertNotesToString(eDataType, instanceValue);
      case GitTabDslPackage.NOTE_VALUES:
        return convertNoteValuesToString(eDataType, instanceValue);
      default:
        throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
    }
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public TabModel createTabModel()
  {
    TabModelImpl tabModel = new TabModelImpl();
    return tabModel;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public Import createImport()
  {
    ImportImpl import_ = new ImportImpl();
    return import_;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public Tuning createTuning()
  {
    TuningImpl tuning = new TuningImpl();
    return tuning;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public GuitarStr createGuitarStr()
  {
    GuitarStrImpl guitarStr = new GuitarStrImpl();
    return guitarStr;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public ChordLibrary createChordLibrary()
  {
    ChordLibraryImpl chordLibrary = new ChordLibraryImpl();
    return chordLibrary;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public ChordDefinition createChordDefinition()
  {
    ChordDefinitionImpl chordDefinition = new ChordDefinitionImpl();
    return chordDefinition;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public Tab createTab()
  {
    TabImpl tab = new TabImpl();
    return tab;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public Beat createBeat()
  {
    BeatImpl beat = new BeatImpl();
    return beat;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public Tone createTone()
  {
    ToneImpl tone = new ToneImpl();
    return tone;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public Stroke createStroke()
  {
    StrokeImpl stroke = new StrokeImpl();
    return stroke;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public DownStroke createDownStroke()
  {
    DownStrokeImpl downStroke = new DownStrokeImpl();
    return downStroke;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public UpStroke createUpStroke()
  {
    UpStrokeImpl upStroke = new UpStrokeImpl();
    return upStroke;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public Pause createPause()
  {
    PauseImpl pause = new PauseImpl();
    return pause;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public Hold createHold()
  {
    HoldImpl hold = new HoldImpl();
    return hold;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public Sound createSound()
  {
    SoundImpl sound = new SoundImpl();
    return sound;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public Chord createChord()
  {
    ChordImpl chord = new ChordImpl();
    return chord;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public Note createNote()
  {
    NoteImpl note = new NoteImpl();
    return note;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NoteWrapper createNoteWrapper()
  {
    NoteWrapperImpl noteWrapper = new NoteWrapperImpl();
    return noteWrapper;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public Fret createFret()
  {
    FretImpl fret = new FretImpl();
    return fret;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NoteName createNoteName()
  {
    NoteNameImpl noteName = new NoteNameImpl();
    return noteName;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public GuitarSound createGuitarSoundFromString(EDataType eDataType, String initialValue)
  {
    GuitarSound result = GuitarSound.get(initialValue);
    if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
    return result;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public String convertGuitarSoundToString(EDataType eDataType, Object instanceValue)
  {
    return instanceValue == null ? null : instanceValue.toString();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public Notes createNotesFromString(EDataType eDataType, String initialValue)
  {
    Notes result = Notes.get(initialValue);
    if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
    return result;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public String convertNotesToString(EDataType eDataType, Object instanceValue)
  {
    return instanceValue == null ? null : instanceValue.toString();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NoteValues createNoteValuesFromString(EDataType eDataType, String initialValue)
  {
    NoteValues result = NoteValues.get(initialValue);
    if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
    return result;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public String convertNoteValuesToString(EDataType eDataType, Object instanceValue)
  {
    return instanceValue == null ? null : instanceValue.toString();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public GitTabDslPackage getGitTabDslPackage()
  {
    return (GitTabDslPackage)getEPackage();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @deprecated
   * @generated
   */
  @Deprecated
  public static GitTabDslPackage getPackage()
  {
    return GitTabDslPackage.eINSTANCE;
  }

} //GitTabDslFactoryImpl
